<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hello React</title>

</head>

<body>
    <div id="root"></div>
    <div id="app"></div>
    <!-- react需要添加的依赖 -->
    <!-- 
        react
        react-dom react渲染在不同平台所需要的核心代码
        babel jsx转换成react代码的工具
     -->
    <!-- 三种方式引入 -->
    <!-- CDN -->
    <!-- crossorigin解决跨域问题 -->
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <!-- babel -->
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
    
    <script type="text/babel">
        // 编写react代码（jsx语法）
        // jsx语法 -> 普通的JavaScript代码-> babel
        // react18之前：ReactDOM.render
        // ReactDOM.render(<h2>Hello World</h2>,document.querySelector("#root"))
        
        // React18之后:
        const root = ReactDOM.createRoot(document.querySelector("#root"))
        root.render(<h2>Hello World</h2>)
        
        // const app = ReactDOM.createRoot(document.querySelector("#app"))
        // app.render(<h2>你好世界</h2>)

        
    </script>
</body>

</html>